package com.odd.webapp.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.TextBox;

/**
 * TODO FieldCreateDialogBox class-level Javadoc.
 *
 * <p>...</p>
 *
 */
public class FieldCreateDialogBox extends Composite {

  private static FieldCreateDialogBoxUiBinder uiBinder = GWT.create(FieldCreateDialogBoxUiBinder.class);

  interface FieldCreateDialogBoxUiBinder extends UiBinder<Widget, FieldCreateDialogBox> {
  }

  @UiField
  Button    buttonSave;
  @UiField
  Button    buttonCancel;
  @UiField
  DialogBox dialogBox;
  @UiField
  TextBox   categoryName;
  @UiField
  TextBox   name;


  public FieldCreateDialogBox(String firstName) {
    initWidget(uiBinder.createAndBindUi(this));
  }

  @UiHandler("buttonSave")
  void doClick(ClickEvent e) {
    /*Open_data_dictionary.getService().createField(categoryName.getText(), name.getText(), new AsyncCallback() {

      public void onFailure(Throwable caught) {
        GWT.log("Server failure!", null);
      }

      public void onSuccess(Object result) {
        GWT.log("Saved Field! ", null);
        dialogBox.hide();
      }
    });*/
  }


  @UiHandler("buttonCancel")
  void onClick(ClickEvent e) {
    dialogBox.hide();
  }

}
